﻿using System.Windows.Forms;
using LazyPlugins.AutoAttacher.UI;
using LazyPlugins.DeclarativeAddinCreator;

namespace LazyPlugins.AutoAttacher.CustomActions
{
    [AddinButtonCaption("Options", "Options")]
    [AddinButtonIconName("options.png")]
    internal class OptionsAction : AddinActionBase
    {
        public override void Execute()
        {
            ActionsHelper actionsHelper = ActionsHelper.GetInstance(ApplicationObject);
            var options = new Options(actionsHelper.ProcessName, actionsHelper.WaitTimeout);
            if(options.ShowDialog() == DialogResult.OK)
            {
                actionsHelper.ProcessName = options.ProcessName;
                actionsHelper.WaitTimeout = options.WaitTimeout;
            }
        }

        public override void OnDisconnect()
        {

        }
    }
}
